﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zhao.Models.Entity
{
    /// <summary>
    /// ActivityMemberChangeOrders 实体类，对应数据库中的 ActivityMemberChangeOrders 表
    /// </summary>
    [SugarTable("ActivityMemberChangeOrders")]  // 映射到数据库中的表名，确保和实际表名一致
    public class ActivityMemberChangeOrders
    {
        /// <summary>
        /// 变更单ID，自增主键
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "ChangeOrderId")]
        public int ChangeOrderId { get; set; }

        /// <summary>
        /// 变更类型：1=增加人数  3=减少人数（简化判断）
        /// </summary>
        [SugarColumn(ColumnName = "ChangeType")]
        public short ChangeType { get; set; }

        /// <summary>
        /// ActivityMembers.ID（被修改的报名记录）
        /// </summary>
        [SugarColumn(ColumnName = "ActivityMemberId")]
        public int ActivityMemberId { get; set; }

        /// <summary>
        /// 首次报名的订单/上次补购的订单
        /// </summary>
        [SugarColumn(ColumnName = "OriginalOrderId")]
        public int OriginalOrderId { get; set; }

        /// <summary>
        /// 补购时生成的新订单/退款单
        /// </summary>
        [SugarColumn(ColumnName = "NewOrderId")]
        public int NewOrderId { get; set; }

        /// <summary>
        /// 修改前的人数（修改前的人数）
        /// </summary>
        [SugarColumn(ColumnName = "OriginalNumbe")]  // 注意：你表结构里字段名是 OriginalNumb，这里保持一致
        public int? OriginalNumbe { get; set; }

        /// <summary>
        /// 新报名人数（修改后的目标人数）
        /// </summary>
        [SugarColumn(ColumnName = "NewNumber")]
        public int? NewNumber { get; set; }

        /// <summary>
        /// 计算变更量
        /// </summary>
        [SugarColumn(ColumnName = "ChangeCount")]
        public int? ChangeCount { get; set; }

        /// <summary>
        /// 发起修改时间
        /// </summary>
        [SugarColumn(ColumnName = "ChangeInitiateTime")]
        public DateTime? ChangeInitiateTime { get; set; }

        /// <summary>
        /// 变更单状态：1=待处理 3=处理中 5=已完成 7=已取消
        /// </summary>
        [SugarColumn(ColumnName = "ChangeStatus")]
        public byte? ChangeStatus { get; set; }

        /// <summary>
        /// 处理完成时间
        /// </summary>
        [SugarColumn(ColumnName = "ChangeCompleteTime")]
        public DateTime? ChangeCompleteTime { get; set; }

        /// <summary>
        /// 备注（用户可填修改原因，或系统填异常信息）
        /// </summary>
        [SugarColumn(ColumnName = "Remark", Length = 512)]
        public string Remark { get; set; }

        /// <summary>
        /// 操作人ID（谁发起的修改）
        /// </summary>
        [SugarColumn(ColumnName = "OperatorUserId")]
        public int? OperatorUserId { get; set; }
        /// <summary>
        /// 退款的订单id
        /// </summary>
        [SugarColumn(ColumnName = "RefundOrderId")]
        public int? RefundOrderId { get; set; }
    }
}
